# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.VMwareEngine.V1.Model.NetworkPolicy do
  @moduledoc """
  Represents a network policy resource. Network policies are regional resources. You can use a network policy to enable or disable internet access and external IP access. Network policies are associated with a VMware Engine network, which might span across regions. For a given region, a network policy applies to all private clouds in the VMware Engine network associated with the policy.

  ## Attributes

  *   `createTime` (*type:* `DateTime.t`, *default:* `nil`) - Output only. Creation time of this resource.
  *   `description` (*type:* `String.t`, *default:* `nil`) - Optional. User-provided description for this network policy.
  *   `edgeServicesCidr` (*type:* `String.t`, *default:* `nil`) - Required. IP address range in CIDR notation used to create internet access and external IP access. An RFC 1918 CIDR block, with a "/26" prefix, is required. The range cannot overlap with any prefixes either in the consumer VPC network or in use by the private clouds attached to that VPC network.
  *   `externalIp` (*type:* `GoogleApi.VMwareEngine.V1.Model.NetworkService.t`, *default:* `nil`) - Network service that allows External IP addresses to be assigned to VMware workloads. This service can only be enabled when `internet_access` is also enabled.
  *   `internetAccess` (*type:* `GoogleApi.VMwareEngine.V1.Model.NetworkService.t`, *default:* `nil`) - Network service that allows VMware workloads to access the internet.
  *   `name` (*type:* `String.t`, *default:* `nil`) - Output only. Identifier. The resource name of this network policy. Resource names are schemeless URIs that follow the conventions in https://cloud.google.com/apis/design/resource_names. For example: `projects/my-project/locations/us-central1/networkPolicies/my-network-policy`
  *   `uid` (*type:* `String.t`, *default:* `nil`) - Output only. System-generated unique identifier for the resource.
  *   `updateTime` (*type:* `DateTime.t`, *default:* `nil`) - Output only. Last update time of this resource.
  *   `vmwareEngineNetwork` (*type:* `String.t`, *default:* `nil`) - Optional. The relative resource name of the VMware Engine network. Specify the name in the following form: `projects/{project}/locations/{location}/vmwareEngineNetworks/{vmware_engine_network_id}` where `{project}` can either be a project number or a project ID.
  *   `vmwareEngineNetworkCanonical` (*type:* `String.t`, *default:* `nil`) - Output only. The canonical name of the VMware Engine network in the form: `projects/{project_number}/locations/{location}/vmwareEngineNetworks/{vmware_engine_network_id}`
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :createTime => DateTime.t() | nil,
          :description => String.t() | nil,
          :edgeServicesCidr => String.t() | nil,
          :externalIp => GoogleApi.VMwareEngine.V1.Model.NetworkService.t() | nil,
          :internetAccess => GoogleApi.VMwareEngine.V1.Model.NetworkService.t() | nil,
          :name => String.t() | nil,
          :uid => String.t() | nil,
          :updateTime => DateTime.t() | nil,
          :vmwareEngineNetwork => String.t() | nil,
          :vmwareEngineNetworkCanonical => String.t() | nil
        }

  field(:createTime, as: DateTime)
  field(:description)
  field(:edgeServicesCidr)
  field(:externalIp, as: GoogleApi.VMwareEngine.V1.Model.NetworkService)
  field(:internetAccess, as: GoogleApi.VMwareEngine.V1.Model.NetworkService)
  field(:name)
  field(:uid)
  field(:updateTime, as: DateTime)
  field(:vmwareEngineNetwork)
  field(:vmwareEngineNetworkCanonical)
end

defimpl Poison.Decoder, for: GoogleApi.VMwareEngine.V1.Model.NetworkPolicy do
  def decode(value, options) do
    GoogleApi.VMwareEngine.V1.Model.NetworkPolicy.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.VMwareEngine.V1.Model.NetworkPolicy do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
